using System;

namespace octalforty.Componento.ComponentModel.Commanding
{
    public class CommandArgumentContainer
    {
        private readonly string[] args;

        public string[] Args
        {
            get { return args; }
        }

        public CommandArgumentContainer(string[] args)
        {
            this.args = args;
        }

        public bool Contains(string argument)
        {
            return Array.Find(Args,
                delegate(string s)
                    { return string.Compare(s, argument, StringComparison.CurrentCultureIgnoreCase) == 0; }) 
                != null;
        }

        public string ValueAfter(string argument)
        {
            return Args[Array.FindIndex(Args,
                delegate(string s) { return string.Compare(s, argument, StringComparison.CurrentCultureIgnoreCase) == 0; }) + 1];
        }
    }
}
